//
//  firstview.m
//  Bettle
//
//  Created by Apple on 2017/1/1.
//  Copyright © 2017年 panhongliu. All rights reserved.
//
#import "firstview.h"
#import "DEFINE.h"
@interface firstview ()
@property(nonatomic,strong)NSArray *array;
@property(nonatomic,strong)NSArray *array1;

@end

@implementation firstview

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.array = @[@"综合筛选",@"距离筛选",@"分类筛选",@"区域筛选"];

        [self customtitleview];
        
    }
    return self;
}
-(void)customtitleview{
    CGFloat ViewWH =SCREEN_WIDTH/4;
    CGFloat ViewHT =59;
    UIView *titlelineview = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 1)];
    titlelineview.backgroundColor = [UIColor lightGrayColor];
    [self addSubview:titlelineview];
    for (int i = 0; i<_array.count; i++) {
        UIView *views = [[UIView alloc]initWithFrame:CGRectMake(ViewWH*i, 1, ViewWH, ViewHT)];
        views.backgroundColor =[UIColor whiteColor];
        //[self custonChildView:views num:i];
        
        
        
        UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, views.yzRight-ViewWH*i-15, views.yzHeight)];
        //btn.backgroundColor = [UIColor cyanColor];
        
        
        [btn setTitle:_array[i] forState:UIControlStateNormal];
        [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        
        
        UIImageView *imgView = [[UIImageView alloc]initWithFrame:CGRectMake(btn.yzRight,btn.yzHeight/2-7, 14, 14)];
        imgView.backgroundColor = [UIColor lightGrayColor];
        
        
        
        UIView *lineView = [[UIView alloc]initWithFrame:CGRectMake(imgView.yzRight, 5, 1,views.yzHeight-10)];
        lineView.backgroundColor = [UIColor lightGrayColor];
        
        
        [views addSubview:btn];
        [views addSubview:imgView];
        [views addSubview:lineView];
        [self addSubview:views];

    }
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
